package com.bloveoa.zkkd.redis.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * Redis切面处理类
 *
 * @author lihe
 */
@Aspect
@Component
@Slf4j
public class RedisAspect {

    @Around("execution(* com.bloveoa.zkkd.redis.utils.RedisUtil.*(..))")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        Object result;
        try {
            result = point.proceed();
        } catch (Exception e) {
            log.error("redis error", e);
            throw new Exception("REDIS SERVER IS DOWN!");
        }
        return result;
    }
}
